package com.cmower.dzone.trycatchfinally;

import java.io.*;
import java.net.URLDecoder;

public class TrywithresourcesWrite {
    public static void main(String[] args) {
        String path = TrywithresourcesWrite.class.getResource("/牛逼.txt").getFile();
        String writePath = TrywithresourcesWrite.class.getResource("/niubi.txt").getFile();
        String decodePath = null;
        try {
            decodePath = URLDecoder.decode(path, "utf-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
try (BufferedReader br = new BufferedReader(new FileReader(decodePath));
     PrintWriter writer = new PrintWriter(new File(writePath))) {
    String str = null;
    while ((str =br.readLine()) != null) {
        writer.print(str);
    }
} catch (IOException e) {
    e.printStackTrace();
}
    }
}
